<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head th:include="include :: header"></head>
<body class="hold-transition skin-blue sidebar-mini">
<section class="content-header">
    <h1 id="title"></h1>
    <input id="odrId" th:value="${odrId}" type="hidden"/>
</section>
<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <div class="box-header">
                    <!--出库单显示-->
                    <div class="row" id="out" hidden>
                        <div class="form-inline">
                            <form id="outForm">
                                <div class="form-group" style="padding: 5px">
                                    <label>单据编号</label>
                                    <input type="text" name="odrCode" class="form-control"
                                           readonly="readonly">
                                </div>
                                <div class="form-group" style="padding: 5px">
                                    <label>领料人</label>
                                    <input type="text" name="odrTakePerson" class="form-control"
                                           readonly="readonly">
                                </div>
                                <div class="form-group" style="padding: 5px">
                                    <label>出库日期</label>
                                    <input type="text" name="odrDate" class="form-control" readonly="readonly">
                                </div>
                                <div class="form-group" style="padding: 5px">
                                    <label>摘要</label>
                                    <input type="text" name="odrRemark" class="form-control" readonly="readonly"/>
                                </div>
                                <div class="form-group" style="padding: 5px">
                                    <label>出库车间</label>
                                    <select type="text" id="odrTakeTeam" name="odrTakeWorkshopId"
                                            onmousedown="javascript:return false;"
                                            class="form-control select" readonly="readonly">
                                    </select>
                                </div>
                                <div class="form-group" style="padding: 5px">
                                    <label>制单人</label>
                                    <input type="text" name="odrMakePerson" class="form-control" readonly="readonly"/>
                                </div>
                            </form>
                        </div>
                    </div>
                    <!--串料显示-->
                    <div class="row" id="changeOut" hidden>
                        <div class="form-inline">
                            <div class="form-group col-sm-3">
                                <label>单据编号</label>
                                <input type="text" name="odrCode" class="form-control"
                                       placeholder="请输入单据编号" readonly="readonly">
                            </div>
                            <div class="form-group col-sm-3">
                                <label>领料人</label>
                                <input type="text" name="odrTakePerson" class="form-control"
                                       placeholder="领料人">
                            </div>
                            <div class="form-group col-sm-3">
                                <label>出库日期</label>
                                <input type="text" name="odrDate" class="form-control"

                                       readonly="readonly">
                            </div>
                            <div class="form-group col-sm-3">
                                <label>摘要</label>
                                <input type="text" name="odrRemark" class="form-control"/>
                            </div>
                        </div>
                    </div>
                    <!--调拨单显示-->
                    <div class="row" id="allocationOut" hidden>
                        <div class="form-inline">
                            <div class="col-md-12">
                                <form id="allocationForm">
                                    <div class="col-md-12">
                                        <h3>调拨单记录</h3>
                                    </div>
                                    <div class="col-md-12">
                                        <table id="allocationTable" style="border: #2a2a2b 1px solid" width="100%"
                                               class="table-hover table-bordered">

                                        </table>
                                    </div>
                                </form>
                            </div>
                            <div class="col-md-12" style="margin-top:50px">
                                <form id="allocationOutForm">
                                    <div class="col-md-12">
                                        <h3>外购件库出库单数据</h3>
                                    </div>
                                    <div class="col-md-12">
                                        <div class="form-inline">
                                            <div class="form-group" style="padding: 5px">
                                                <label>单据编号</label>
                                                <input type="text" name="odrCode" class="form-control"
                                                       readonly="readonly">
                                            </div>
                                            <div class="form-group" style="padding: 5px">
                                                <label>领料人</label>
                                                <input type="text" name="odrTakePerson" class="form-control"
                                                       readonly="readonly">
                                            </div>
                                            <div class="form-group" style="padding: 5px">
                                                <label>出库日期</label>
                                                <input type="text" name="odrDate" class="form-control"
                                                       readonly="readonly">
                                            </div>
                                            <div class="form-group" style="padding: 5px">
                                                <label>摘要</label>
                                                <input type="text" name="odrRemark" class="form-control"
                                                       readonly="readonly"/>
                                            </div>
                                            <div class="form-group" style="padding: 5px">
                                                <label>领料车间</label>
                                                <select type="text" id="odrTakeTeam2" name="odrTakeWorkshopId"
                                                        onmousedown="javascript:return false;"
                                                        class="form-control select" readonly="readonly">
                                                </select>
                                                <!--onmousedown="javascript:return false;"-->
                                                <!--这句话是 让下拉框无法点击，只能显示-->
                                            </div>

                                            <div class="form-group" style="padding: 5px">
                                                <label>制单人</label>
                                                <input type="text" name="odrMakePerson" class="form-control"
                                                       readonly="readonly"/>
                                            </div>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                    <!--入库单显示-->
                    <div class="row" id="in" hidden>
                        <div class="form-inline">
                            <form id="inForm">
                                <div class="form-group col-sm-3">
                                    <label>单据编号</label>
                                    <input type="text" name="odrCode" class="form-control"
                                           readonly="readonly">
                                </div>
                                <div class="form-group col-sm-3">
                                    <label>制单人</label>
                                    <input type="text" name="odrMakePerson" class="form-control"
                                           readonly="readonly">
                                </div>
                                <div class="form-group col-sm-3">
                                    <label>入库日期</label>
                                    <input type="text" name="odrDate" class="form-control" readonly="readonly">
                                </div>
                                <div class="form-group col-sm-3">
                                    <label>摘要</label>
                                    <input type="text" name="odrRemark" class="form-control" readonly="readonly"/>
                                </div>
                                <div class="form-group col-sm-3">
                                    <label>入库类型</label>
                                    <input type="text" name="odrOutTypeName" class="form-control" readonly="readonly"/>
                                </div>
                                <div class="form-group col-sm-3">
                                    <label>往来部门</label>
                                    <input type="text" name="odrDeptName" class="form-control" readonly="readonly"/>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
                <div class="box-body">
                    <div id="hot"/>
                </div>
                <div style="text-align: right;margin-top: 10px">
                    <button shiro:hasPermission="jiagong:storage:print" type="button" id="btn_print"
                            class="btn btn-info file-contract btn-file">打印
                    </button>
                </div>
            </div>
        </div>
    </div>
</section>
<div id="printDiv" width="100%" style="display: none">
    <div style="padding-bottom: 10px;text-align:center;vertical-align: middle;">
        <div style="font-size: 20px;vertical-align: middle;display:inline-block;font-weight:bold">
            辽宁忠旺机械设备制造有限公司出库单
        </div>
    </div>
    <table style="font-size: 12px;width: 100%;line-height: 20px">
        <tr>
            <td>单据编号：<span id="printOdrCode" style="padding-left: 5px"></span></td>
            <td>使用部门：<span id="printUseDept" style="padding-left: 5px"></span></td>
            <td>制单人：<span id="printMakeOrderPerson" style="padding-left: 5px"></span></td>
            <td>出库日期：<span id="printOdrDate" style="padding-left: 5px"></span></td>
        </tr>
        <tr>
            <td colspan="2">摘要：<span id="printOdrRemark" style="padding-left: 5px"></span></td>
            <td colspan="2">领料人：<span id="printTakePerson" style="padding-left: 5px"></span></td>
        </tr>
    </table>
    <div id="table-box">
    </div>
    <table style="font-size: 16px;width: 100%;margin-top: 10px">
        <tr>
            <td width="45%">物资保管员签字：</td>
            <td>领件人员签字：</td>
        </tr>
    </table>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">


    var bTable;
    //仓库数组
    var warehouseInfoArray;
    //入库类型
    var oadItyStockTypeArray = ["", "库存在库", "项目在库"];

    /**
     *
     * */
    function loadPageData() {
        $.post(ctx + "jiaGongAccountQuery/findOdaListByOdrId",
            {
                odrId: $("#odrId").val()
            },
            function (result) {
                js.post({
                    url: ctx + "purWarOutManage/findDeptList",
                    data: {},
                    contentType: "application/json",
                    async: false,
                    success: function (res) {
                        if (res.type == 'SUCCESS') {
                            var list = res.data;
                            $('#odrTakeTeam').empty();
                            for (var i = 0; i < list.length; i++) {
                                $('#odrTakeTeam').append('<option value="' + list[i].depId + '">' + list[i].depName + '</option>');
                            }
                            $('#odrTakeTeam2').empty();
                            for (var i = 0; i < list.length; i++) {
                                $('#odrTakeTeam2').append('<option value="' + list[i].depId + '">' + list[i].depName + '</option>');
                            }
                            if (result.data.formData != undefined && result.data.formData.odrReqFlag == 1) {
                                /**
                                 *可编辑表格
                                 */
                                var process = function (data) {
                                }
                                js.hot.init({
                                    element: document.getElementById('hot'),
                                    data: {},
                                    formData: ["odrCode", "odrTakePerson", "odrDate", "odrRemark"],
                                    colHeaders: ['ID', 'ID1', '物料描述', '数量', '单位', '项目编号', '项目名称', '供应商','合同编号','领用类型', '在库类型', '仓位', '特殊说明'],
                                    fieldName: ['odaId', 'ityId', 'odaMatDesc', 'odaNum', 'odaNumUnit', 'odaProCode', 'odaProName', 'supplier','contractNo', 'odaTakeType', 'odaItyStockType', 'odaPosition', 'oda_spec'],
                                    height: 640,
                                    minRows: 100,
                                    hiddenColumns: {
                                        columns: [0, 1],
                                        indicators: true
                                    },
                                    callBack: process,
                                    columns: [
                                        {
                                            data: 'odaId',
                                            type: 'numeric',
                                            width: 40
                                        }, {
                                            data: 'ityId',
                                            type: 'numeric',
                                            width: 40
                                        },
                                        {
                                            data: 'odaMatDesc',//物料描述
                                            type: 'text',
                                            readOnly: true
                                        },
                                        {
                                            data: 'odaNum',//数量
                                            type: 'numeric',
                                            readOnly: true
                                        },
                                        {
                                            data: 'odaNumUnit',//单位
                                            type: 'text',
                                            readOnly: true
                                        },
                                        {
                                            data: 'odaProCode',//项目编号
                                            type: 'text',
                                            readOnly: true
                                        },
                                        {
                                            data: 'odaProName',//项目名称
                                            type: 'text',
                                            readOnly: true
                                        },
                                        {
                                            data: 'supplier',//供应商
                                            type: 'text',
                                            readOnly: true
                                        },
                                        {
                                            data: 'contractNo',//合同编号
                                            type: 'text',
                                            readOnly: true
                                        },
                                        {
                                            data: 'odaTakeType',//领用类型
                                            type: 'text',
                                            readOnly: true
                                        },
                                        {
                                            data:'odaItyStockType',//在库类型
                                            type: 'text',
                                            readOnly: true

                                        },
                                        {
                                            data: 'odaPosition',//仓位
                                            type: 'text',
                                            readOnly: true
                                        },
                                        {
                                            data: 'odaSpec',//特殊说明
                                            type: 'text', readOnly: true
                                        }



                                    ]
                                });
                                if (result.data.formData.odrType == 1) {
                                    $("#title").html("调拨入库单");
                                } else {
                                    $("#title").html("调拨出库单");
                                }
                            } else if (result.data.formData.odrType == 2) {

                                js.hot.init({
                                    element: document.getElementById('hot'),
                                    data: {},
                                    formData: ["odrCode", "odrTakePerson", "odrDate", "odrRemark"],
                                    colHeaders: ['ID', 'ID1', '物料描述', '数量', '单位', '项目编号', '项目名称','供应商','合同编号',  '领用类型','在库类型', '仓位', '特殊说明'],
                                    fieldName: ['odaId', 'ityId',  'odaMatDesc', 'odaNum', 'odaNumUnit', 'odaProCode', 'odaProName', 'supplier','contractNo','odaTakeType','odaItyStockType', 'odaPosition', 'oda_spec'],
                                    height: 640,
                                    minRows: 100,
                                    hiddenColumns: {
                                        columns: [0, 1],
                                        indicators: true
                                    },
                                    columns: [
                                        {
                                            data: 'odaId',
                                            type: 'numeric',
                                            width: 40
                                        }, {
                                            data: 'ityId',
                                            type: 'numeric',
                                            width: 40
                                        },
                                        {
                                            data: 'odaMatDesc',//物料描述
                                            type: 'text',
                                            readOnly: true
                                        },
                                        {
                                            data: 'odaNum',//数量
                                            type: 'numeric',
                                            readOnly: true
                                        },
                                        {
                                            data: 'odaNumUnit',//单位
                                            type: 'text',
                                            readOnly: true
                                        },
                                        {
                                            data: 'odaProCode',//项目编号
                                            type: 'text',
                                            readOnly: true
                                        },
                                        {
                                            data: 'odaProName',//项目名称
                                            type: 'text',
                                            readOnly: true
                                        },
                                        {
                                            data: 'supplier',//供应商
                                            type: 'text',
                                            readOnly: true
                                        },
                                        {
                                            data: 'contractNo',//合同编号
                                            type: 'text',
                                            readOnly: true
                                        },
                                        {
                                            data: 'odaTakeType',//领用类型
                                            type: 'text',
                                            readOnly: true
                                        },
                                        {
                                            data:'odaItyStockType',//在库类型
                                            type: 'text',
                                            readOnly: true

                                        },
                                        {
                                            data: 'odaPosition',//仓位
                                            type: 'text',
                                            readOnly: true
                                        },
                                        {
                                            data: 'odaSpec',//特殊说明
                                            type: 'text', readOnly: true
                                        }
                                    ]
                                });
                                $("#title").html("领料出库单");
                                $("#outForm").fillData(result.data.formData);
                                $("#outForm [name='odrTakePerson']").val(result.data.formData.odrTakePerson);
                                $("#odrTakeTeam").val(result.data.formData.odrTakeWorkshopId);
                                $("#out").show();
                            } else if (result.data.formData.odrType == 1) {
                                $("#title").html("采购入库单");
                                js.hot.init({
                                    element: document.getElementById('hot'),
                                    data: {},
                                    formData: ["odrCode", "odrRemark"],
                                    colHeaders: ['ID', '物料描述', '数量', '单位','项目名称', '项目编号',  '供应商', '合同编号', '仓库', '区位', '记账日期', '特殊说明','在库类型'],
                                    fieldName: ['odaId', 'odaMatDesc', 'odaNum', 'odaNumUnit',  'odaProName', 'odaProCode', 'supplier', 'contractNo', 'warehouseLocation', 'odaPosition', 'odaBookkeepingDate', 'odaSpec','odaItyStockType'],
                                    height: 640,
                                    minRows: 100,
                                    hiddenColumns: {
                                        columns: [0],
                                        indicators: true
                                    },
                                    callBack: process,
                                    columns: [
                                        {
                                            data: 'odaId',
                                            type: 'numeric',
                                            width: 40
                                        },

                                        {
                                            data: 'odaMatDesc',//物料描述
                                            type: 'text', readOnly: true
                                        },
                                        {
                                            data: 'odaNum',//数量
                                            type: 'numeric', readOnly: true
                                        },
                                        {
                                            data: 'odaNumUnit',//单位
                                            type: 'text', readOnly: true
                                        },
                                        {
                                            data: 'odaProName',//项目名称
                                            type: 'text', readOnly: true
                                        },
                                        {
                                            data: 'odaProCode',//项目编号
                                            type: 'text', readOnly: true
                                        },
                                        {
                                            data: 'supplier',//供应商
                                            type: 'text',
                                            readOnly: true
                                        },
                                        {
                                            data: 'contractNo',//合同编号
                                            type: 'text',
                                            readOnly: true
                                        },
                                        {
                                            data: 'warehouseLocation',//仓库
                                            type: 'dropdown',
                                            source: warehouseInfoArray,
                                            readOnly: true
                                        },
                                        {
                                            data: 'odaPosition',//区位
                                            type: 'text',
                                            readOnly: true
                                        },
                                        {
                                            data: 'odaBookkeepingDate',//记账日期
                                            type: 'text', readOnly: true
                                        },
                                        {
                                            data: 'odaSpec',//特殊说明
                                            type: 'text', readOnly: true
                                        },
                                        {
                                            data:'odaItyStockType',//在库类型
                                            type: 'text',
                                            readOnly: true

                                        }
                                    ]
                                });
                                $("#inForm").fillData(result.data.formData);
                                $("#btn_print").hide();
                                $("#in").show();
                            }
                            $("#inForm").fillData(result.data.formData);
                            var data = result.data.insertData;
                            js.hot.loadData(data);
                            // js.modal.success();//这是进入页面就显示的“操作成功”提示框
                            $("#table-box").empty();
                            $("#table-box").append('<table id="outOrderTable"\n' +
                                '               style="font-size: 12px;text-align: center;border-right:1px solid;border-bottom:1px solid; border-collapse: collapse;"\n' +
                                '               width="100%"\n' +
                                '               cellspacing="0" cellpadding="1">\n' +
                                '        </table>');
                            if (result.data.isChangeFlag > 0) {
                                $("#outOrderTable").append('<THEAD style="display:table-header-group;">\n' +
                                    '<TR><td rowspan="2" style="border-left: 1px solid;border-top: 1px solid;">序号</td>' +
                                    // '<td rowspan="2" style="border-left: 1px solid;border-top: 1px solid;">跟踪号</td>' +
                                    // '<td rowspan="2" style="border-left: 1px solid;border-top: 1px solid;">物料编码</td>' +
                                    '<td rowspan="2" style="border-left: 1px solid;border-top: 1px solid;">物料描述</td>' +
                                    '<td rowspan="2" style="border-left: 1px solid;border-top: 1px solid;">区位</td>' +
                                    '<td rowspan="2" style="border-left: 1px solid;border-top: 1px solid;">单位</td>' +
                                    '<td rowspan="2" style="border-left: 1px solid;border-top: 1px solid;">供应商</td>' +
                                    '<td rowspan="2" style="border-left: 1px solid;border-top: 1px solid;">合同编号</td>' +
                                    '<td colspan="3"  style="border-left: 1px solid;border-top: 1px solid;">现项目</td><td colspan="3"  style="border-left: 1px solid;border-top: 1px solid;">原项目</td>' +
                                    '</TR>' +
                                    '<TR><td style="border-left: 1px solid;border-top: 1px solid;">数量</td>' +
                                    '<td style="border-left: 1px solid;border-top: 1px solid;">项目编号</td>' +
                                    '<td style="border-left: 1px solid;border-top: 1px solid;width: 100px;">项目名称</td>' +
                                    '<td style="border-left: 1px solid;border-top: 1px solid;">数量</td>' +
                                    '<td style="border-left: 1px solid;border-top: 1px solid;">项目编号</td>' +
                                    '<td style="border-left: 1px solid;border-top: 1px solid;">项目名称</td>' +
                                    '</TR></THEAD>');
                                $("#outOrderTable").append('<tbody id="outOrderTableTbody"></tbody>');
                                var list = result.data.insertData;
                                $("#printOdrCode").html(result.data.formData.odrCode);
                                $("#printUseDept").html(result.data.formData.odrUseDept);
                                $("#printMakeOrderPerson").html(result.data.formData.odrMakePerson);
                                $("#printOdrDate").html(result.data.formData.odrDate);
                                $("#printOdrRemark").html(result.data.formData.odrRemark);
                                $("#printTakePerson").html(result.data.formData.odrTakePerson);
                                for (var i = 0; i < list.length; i++) {
                                    if (list[i].odaMatDesc != null && list[i].odaMatDesc != '') {
                                        let odaTrackCode = "";
                                        if (list[i].odaTrackCode != undefined && list[i].odaTrackCode != null) {
                                            odaTrackCode = list[i].odaTrackCode;
                                        }
                                        let odaSapCode = "";
                                        if (list[i].odaSapCode != undefined && list[i].odaSapCode != null) {
                                            odaSapCode = list[i].odaSapCode;
                                        }
                                        let odaMatDesc = "";
                                        if (list[i].odaMatDesc != undefined && list[i].odaMatDesc != null) {
                                            odaMatDesc = list[i].odaMatDesc;
                                        }


                                        let odaNumUnit = "";
                                        if (list[i].odaNumUnit != undefined && list[i].odaNumUnit != null) {
                                            odaNumUnit = list[i].odaNumUnit;
                                        }
                                        let odaNum = "";
                                        if (list[i].odaNum != undefined && list[i].odaNum != null) {
                                            odaNum = list[i].odaNum;
                                        }
                                        let odaProCode = "";
                                        if (list[i].odaProCode != undefined && list[i].odaProCode != null) {
                                            odaProCode = list[i].odaProCode;
                                        }
                                        let odaProName = "";
                                        if (list[i].odaProName != undefined && list[i].odaProName != null) {
                                            odaProName = list[i].odaProName;
                                        }
                                        let odaNumSource = "";
                                        if (list[i].odaNumSource != undefined && list[i].odaNumSource != null) {
                                            odaNumSource = list[i].odaNumSource;
                                        }
                                        let odaProCodeSource = "";
                                        if (list[i].odaProCodeSource != undefined && list[i].odaProCodeSource != null) {
                                            odaProCodeSource = list[i].odaProCodeSource;
                                        }
                                        let odaProNameSource = "";
                                        if (list[i].odaProNameSource != undefined && list[i].odaProNameSource != null) {
                                            odaProNameSource = list[i].odaProNameSource;
                                        }
                                        let odaTakeType = "";
                                        if (list[i].odaTakeType != undefined && list[i].odaTakeType != null) {
                                            odaTakeType = list[i].odaTakeType;
                                        }
                                        let odaPosition = "";
                                        if (list[i].odaPosition != undefined && list[i].odaPosition != null) {
                                            odaPosition = list[i].odaPosition;
                                        }
                                        $("#outOrderTableTbody").append("<tr>");
                                        //序号
                                        $("#outOrderTableTbody").append("<td style=\"border-left: 1px solid;border-top: 1px solid;\">" + (i + 1) + "</td>");
                                        //跟踪号
                                        // $("#outOrderTableTbody").append("<td style=\"border-left: 1px solid;border-top: 1px solid;\">" + odaTrackCode + "</td>");
                                        //SAP物料编码
                                        // $("#outOrderTableTbody").append("<td style=\"border-left: 1px solid;border-top: 1px solid;\">" + odaSapCode + "</td>");
                                        //物料描述
                                        $("#outOrderTableTbody").append("<td style=\"border-left: 1px solid;border-top: 1px solid;\">" + odaMatDesc + "</td>");
                                        //区位
                                        $("#outOrderTableTbody").append("<td style=\"border-left: 1px solid;border-top: 1px solid;\">" + odaPosition + "</td>");
                                        //单位
                                        $("#outOrderTableTbody").append("<td style=\"border-left: 1px solid;border-top: 1px solid;\">" + odaNumUnit + "</td>");
                                        //单位
                                        $("#outOrderTableTbody").append("<td style=\"border-left: 1px solid;border-top: 1px solid;\"></td>");
                                        //现项目
                                        //数量
                                        $("#outOrderTableTbody").append("<td style=\"border-left: 1px solid;border-top: 1px solid;\">" + odaNum + "</td>");
                                        //项目编号
                                        $("#outOrderTableTbody").append("<td style=\"border-left: 1px solid;border-top: 1px solid;\">" + odaProCode + "</td>");
                                        //项目名称
                                        $("#outOrderTableTbody").append("<td style=\"border-left: 1px solid;border-top: 1px solid;\">" + odaProName + "</td>");
                                        //原项目
                                        //数量
                                        $("#outOrderTableTbody").append("<td style=\"border-left: 1px solid;border-top: 1px solid;\">" + odaNumSource + "</td>");
                                        //项目编号
                                        $("#outOrderTableTbody").append("<td style=\"border-left: 1px solid;border-top: 1px solid;\">" + odaProCodeSource + "</td>");
                                        //项目名称
                                        $("#outOrderTableTbody").append("<td style=\"border-left: 1px solid;border-top: 1px solid;\">" + odaProNameSource + "</td>");
                                        $("#outOrderTableTbody").append("</tr>");
                                    }
                                }
                            } else {
                                $("#outOrderTable").append('<THEAD style="display:table-header-group;">\n' +
                                    '<TR><td style="border-left: 1px solid;border-top: 1px solid;">序号</td>' +
                                    // '<td style="border-left: 1px solid;border-top: 1px solid;">跟踪号</td>' +
                                    // '<td style="border-left: 1px solid;border-top: 1px solid;">物料编码</td>' +
                                    '<td style="border-left: 1px solid;border-top: 1px solid;">OA物料描述</td>' +
                                    '<td style="border-left: 1px solid;border-top: 1px solid;">数量</td>' +
                                    '<td style="border-left: 1px solid;border-top: 1px solid;">单位</td>' +
                                    '<td style="border-left: 1px solid;border-top: 1px solid;">项目编号</td>' +
                                    '<td style="border-left: 1px solid;border-top: 1px solid;width:200px;">项目名称</td>' +
                                    '<td style="border-left: 1px solid;border-top: 1px solid;">供应商</td>' +
                                    '<td style="border-left: 1px solid;border-top: 1px solid;">合同编号</td>' +
                                    '<td style="border-left: 1px solid;border-top: 1px solid;">领用类型</td>' +
                                    '<td style="border-left: 1px solid;border-top: 1px solid;">区位</td>' +
                                    '<td style="border-left: 1px solid;border-top: 1px solid;">特殊说明</td></TR></THEAD>');
                                $("#outOrderTable").append('<tbody id="outOrderTableTbody"></tbody>');
                                var list = result.data.insertData;
                                $("#printOdrCode").html(result.data.formData.odrCode);
                                $("#printUseDept").html(result.data.formData.odrUseDept);
                                $("#printMakeOrderPerson").html(result.data.formData.odrMakePerson);
                                $("#printOdrDate").html(result.data.formData.odrDate);
                                $("#printOdrRemark").html(result.data.formData.odrRemark);
                                $("#printTakePerson").html(result.data.formData.odrTakePerson);
                                for (var i = 0; i < list.length; i++) {
                                    if (list[i].odaMatDesc != null && list[i].odaMatDesc != '') {
                                        let odaTrackCode = "";
                                        if (list[i].odaTrackCode != undefined && list[i].odaTrackCode != null) {
                                            odaTrackCode = list[i].odaTrackCode;
                                        }
                                        let odaSapCode = "";
                                        if (list[i].odaSapCode != undefined && list[i].odaSapCode != null) {
                                            odaSapCode = list[i].odaSapCode;
                                        }
                                        let odaMatDesc = "";
                                        if (list[i].odaMatDesc != undefined && list[i].odaMatDesc != null) {
                                            odaMatDesc = list[i].odaMatDesc;
                                        }
                                        let odaNum = "";
                                        if (list[i].odaNum != undefined && list[i].odaNum != null) {
                                            odaNum = list[i].odaNum;
                                        }
                                        let odaNumUnit = "";
                                        if (list[i].odaNumUnit != undefined && list[i].odaNumUnit != null) {
                                            odaNumUnit = list[i].odaNumUnit;
                                        }
                                        let supplier = "";
                                        if (list[i].supplier != undefined && list[i].supplier != null) {
                                            supplier = list[i].supplier;
                                        }
                                        let contractNo = "";
                                        if (list[i].contractNo != undefined && list[i].contractNo != null) {
                                            contractNo = list[i].contractNo;
                                        }
                                        let odaProCode = "";
                                        if (list[i].odaProCode != undefined && list[i].odaProCode != null) {
                                            odaProCode = list[i].odaProCode;
                                        }
                                        let odaProName = "";
                                        if (list[i].odaProName != undefined && list[i].odaProName != null) {
                                            odaProName = list[i].odaProName;
                                        }
                                        let odaTakeType = "";
                                        if (list[i].odaTakeType != undefined && list[i].odaTakeType != null) {
                                            odaTakeType = list[i].odaTakeType;
                                        }
                                        let odaPosition = "";
                                        if (list[i].odaPosition != undefined && list[i].odaPosition != null) {
                                            odaPosition = list[i].odaPosition;
                                        }
                                        $("#outOrderTableTbody").append("<tr>");
                                        //序号
                                        $("#outOrderTableTbody").append("<td style=\"border-left: 1px solid;border-top: 1px solid;\">" + (i + 1) + "</td>");
                                        //跟踪号
                                        // $("#outOrderTableTbody").append("<td style=\"border-left: 1px solid;border-top: 1px solid;\">" + odaTrackCode + "</td>");
                                        //SAP物料编码
                                        // $("#outOrderTableTbody").append("<td style=\"border-left: 1px solid;border-top: 1px solid;\">" + odaSapCode + "</td>");
                                        //OA物料描述
                                        $("#outOrderTableTbody").append("<td style=\"border-left: 1px solid;border-top: 1px solid;\">" + odaMatDesc + "</td>");
                                        //数量
                                        $("#outOrderTableTbody").append("<td style=\"border-left: 1px solid;border-top: 1px solid;\">" + odaNum + "</td>");
                                        //单位
                                        $("#outOrderTableTbody").append("<td style=\"border-left: 1px solid;border-top: 1px solid;\">" + odaNumUnit + "</td>");

                                        //项目编号
                                        $("#outOrderTableTbody").append("<td style=\"border-left: 1px solid;border-top: 1px solid;\">" + odaProCode + "</td>");
                                        //项目名称
                                        $("#outOrderTableTbody").append("<td style=\"border-left: 1px solid;border-top: 1px solid;\">" + odaProName + "</td>");
                                        //供应商
                                        $("#outOrderTableTbody").append("<td style=\"border-left: 1px solid;border-top: 1px solid;\">" + supplier + "</td>");
                                        //合同编号
                                        $("#outOrderTableTbody").append("<td style=\"border-left: 1px solid;border-top: 1px solid;\">" + contractNo + "</td>");
                                        //领用类型
                                        $("#outOrderTableTbody").append("<td style=\"border-left: 1px solid;border-top: 1px solid;\">" + odaTakeType + "</td>");
                                        //区位
                                        $("#outOrderTableTbody").append("<td style=\"border-left: 1px solid;border-top: 1px solid;\">" + odaPosition + "</td>");
                                        //特殊说明
                                        $("#outOrderTableTbody").append("<td style=\"border-left: 1px solid;border-top: 1px solid;\">" + (list[i].odaSpec == undefined ? "" : list[i].odaSpec) + "</td>");
                                        $("#outOrderTableTbody").append("</tr>");
                                    }
                                }
                            }
                        }
                    }
                });
            }, 'json');
    }



    /**
     *@FunctionName: findWarehouseList
     *@Description: 获取仓库列表
     *@Author: 徐一贺
     *@CreateDate: 2020/3/24 15:31
     *@Phone: 18241927380
     *@Version: 1.0.0
     */
    function findWarehouseList() {
        js.ajax({
            url: ctx + 'common/warehouseInfo/list',
            type: 'post',
            traditional: true,            // 阻止深度序列化， 使参数可以使用数组
            dataType: 'json',
            contentType: "application/x-www-form-urlencoded",
            data: {},
            async: true,                // 异步执行
            success: function (result) {
                if (result.type === web_status.SUCCESS) {
                    $('#ityWhiId').empty();
                    $('#ityWhiId').append('<option value="">全部</option>');
                    for (var i = 0; i < result.data.rows.length; i++) {
                        $('#ityWhiId').append('<option value="' + result.data.rows[i].whiId + '">' + result.data.rows[i].whiName + '</option>');
                    }
                } else {
                    js.modal.warning(result.msg);
                }
            },
            error: function () {
                js.modal.fail();
            }
        })
    }


    /**
     *@FunctionName: findDeptList
     *@Description: 获取部门列表
     *@Author: 徐一贺
     *@CreateDate: 2020/3/24 13:27
     *@Phone: 18241927380
     *@Param:
     *@Return:
     *@Version:
     */
    function findDeptList() {
        js.post({
            url: ctx + "purWarOutManage/findDeptList",
            data: {},
            contentType: "application/json",
            async: false,
            success: function (result) {
                if (result.type == 'SUCCESS') {
                    var list = result.data;
                    $('#odrTakeTeam').empty();
                    for (var i = 0; i < list.length; i++) {
                        $('#odrTakeTeam').append('<option value="' + list[i].depId + '">' + list[i].depName + '</option>');
                    }
                    $('#odrTakeTeam2').empty();
                    for (var i = 0; i < list.length; i++) {
                        $('#odrTakeTeam2').append('<option value="' + list[i].depId + '">' + list[i].depName + '</option>');
                    }
                }
            }
        });
    }

    var ids = [];
    var statusText = ["无状态", "执行中", "未开始", "暂缓", "已完成", "取消"];


    function selectAll(obj) {
        if ($(obj).prop("checked")) {
            $('input[name="cb_inventory"]').prop("checked", true);
        }
        if ($(obj).prop("checked") == false) {
            $('input[name="cb_inventory"]').prop("checked", false);
        }
    }


    $(function () {
        findDeptList();
        loadPageData();
        // getNewOrderCode();
        /**
         *@FunctionName: 加载仓库下拉框内容
         *@Description: 请填写方法描述
         *@Author: 徐一贺
         *@CreateDate: 2020/3/18 14:10
         *@Phone: 18241927380
         */
        js.ajax({
            url: ctx + 'common/warehouseInfo/list',
            type: 'post',
            traditional: true,            // 阻止深度序列化， 使参数可以使用数组
            dataType: 'json',
            contentType: "application/x-www-form-urlencoded",
            data: {},
            async: false,                // 异步执行
            success: function (result) {
                if (result.type === web_status.SUCCESS) {
                    warehouseInfoArray = new Array();
                    for (var i = 0; i < result.data.rows.length; i++) {
                        warehouseInfoArray.push(result.data.rows[i].whiCode);
                    }
                } else {
                    js.modal.warning(result.msg);
                }
            },
            error: function () {
                js.modal.fail();
            }
        })
        //加载列表数据
        bTable = js.table.init({
            id: 'inventoryQueryTable',
            url: ctx + "purWarOutManage/inventoryList",
            sortable: true,                                    // 是否启用排序
            sortStable: true,                                  // 设置为 true 将获得稳定的排序
            showColumns: true,
            showExport: false,
            pageSize: 15,
            onClickRow: function (row, $element) {
                if ($('#cb_inventory_' + row.ityId).prop("checked")) {
                    $('#cb_inventory_' + row.ityId).prop("checked", false);
                    $($element).removeClass('info');
                } else {
                    $('#cb_inventory_' + row.ityId).prop("checked", true);
                    $($element).addClass('info');
                }
            },
            onLoadSuccess: function () {
                $('#inventoryQueryTable thead th').each(function () {
                    $(this).width(Math.floor($(this).width()));
                });
                $('#inventoryQueryTable tbody tr:first td').each(function () {
                    $(this).width(Math.floor($(this).width()));
                });
            },
            columns: [
                {
                    title: '序号', field: 'ityId', width: '50',
                    formatter: function (value, row, index) {

                        let pageSize = bTable.bootstrapTable('getOptions').pageSize;
                        let pageNumber = bTable.bootstrapTable('getOptions').pageNumber;
                        return pageSize * (pageNumber - 1) + index + 1;
                    }
                },
                {title: '物料编码', field: 'itySapCode', width: '120'},
                {title: '物料描述', field: 'ityMatDesc', width: '200'},
                {title: '数量', field: 'ityNum', sortable: true},
                {title: '单位', field: 'ityNumUnit'},
                // {title: '跟踪号', field: 'ityTrackCode'},
                {
                    title: '项目名称', field: 'ityProName', width: '200',
                    formatter: function (value, row, index) {
                        return value
                    }
                },
                {title: '项目编号', field: 'ityProCode'},
                {
                    title: '生产状态', field: 'proProductionStatus',
                    formatter: function (value, row, index) {
                        if (value == undefined || value == null) {
                            value = 0;
                        }
                        return statusText[value];
                    }
                },
                {
                    title: '特殊说明', field: 'ityRemark',
                    formatter: function (value, row, index) {
                        if (value == undefined || value == null) {
                            return "";
                        }
                        return value;
                    }
                },
                {title: '仓库', field: 'whiName'},
                {title: '库位', field: 'ityPosition'},
                {
                    title: '<input title="全选" onclick="selectAll(this)" type="checkbox" />',
                    width: '40',
                    field: 'ityDataStatus',
                    formatter: function (value, row, index) {
                        var ityDataStatus = "";
                        if (value == 2) {
                            ityDataStatus = 'disabled';
                        } else {
                            ityDataStatus = '';
                        }
                        ids.push('cb_inventory_' + row.ityId);
                        return '<input ' + ityDataStatus + ' id="' + 'cb_inventory_' + row.ityId + '" name="cb_inventory" data="' + row.ityId + '"  type="checkbox" />';
                    }
                }
            ]
        });


        /**
         * 表格搜索
         */
        $("#btn_print").on('click', function () {
            $("#printDiv").show();
            Print('#printDiv');
            $("#printDiv").hide();
        });

        var rows;

        var ityIds = "";
    });
</script>
</body>
</html>
